feat(upgrade): Add Vue-specific Protect to Show codemod#7615
feat(upgrade): Add Vue-specific Protect to Show codemod#7615jacekradko merged 5 commits intomainfrom
Conversation
Vue SFC files require different prop syntax than React JSX:
- React: `<Protect role="admin">` → `<Show when={{ role: 'admin' }}>`
- Vue: `<Protect role="admin">` → `<Show :when="{ role: 'admin' }">`
This adds a Vue-specific codemod that:
- Transforms script imports (Protect → Show, ProtectProps → ShowProps)
- Transforms template components with Vue v-bind syntax
- Handles static and dynamic prop bindings
- Handles condition callbacks
- Only transforms when clerk imports are detected
The core-3 config is updated to run the appropriate codemod:
- `transform-protect-to-show` for React-based SDKs
- `transform-protect-to-show-vue` for Vue/Nuxt SDKs
🦋 Changeset detectedLatest commit: 61c025d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
📝 WalkthroughWalkthroughAdds a Vue-specific codemod and supporting tests/metadata to the upgrade package. New files: a changeset, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
wobsoriano
left a comment
There was a problem hiding this comment.
looks good here! thank you
Summary
Fixes: USER-4353
Vue SFC files require different prop syntax than React JSX when binding objects to props:
<Protect role="admin"><Protect role="admin"><Show when={{ role: 'admin' }}><Show :when="{ role: 'admin' }">This PR adds a Vue-specific codemod (
transform-protect-to-show-vue) that handles.vueSFC files with proper Vue v-bind syntax.Changes
transform-protect-to-show-vue.cjs- Handles Vue SFC filestransform-protect-to-show→nextjs,react,expo,react-router,tanstack-react-start,astrotransform-protect-to-show-vue→vue,nuxtVue Codemod Features
<script>imports (Protect → Show, ProtectProps → ShowProps)<template>components with Vue v-bind syntaxrole="admin") →:when="{ role: 'admin' }":role="dynamicRole") →:when="{ role: dynamicRole }":condition="..."→:when="...")>and/inside quoted attribute values (like arrow functions)Test plan
@clerk/vue@clerk/nuxtSummary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.